import 'package:flutter/material.dart';
import 'package:videotop/base_view.dart';
import 'package:videotop/model/choosesex_model.dart';
import 'package:videotop/mycolor.dart';
import 'package:videotop/myinfo.dart';
import 'package:videotop/screen_service.dart';
import 'package:videotop/util.dart';
import 'package:provider/provider.dart';

class ChooseSex extends StatefulWidget {
  int type;
  String logid;
  String psd;

  ChooseSex({this.type, this.logid, this.psd: ''});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _ChooseSex();
  }
}

class _ChooseSex extends State<ChooseSex> {
  @override
  Widget build(BuildContext context) {
    return BaseView<ChooseSexModel>(
      model: ChooseSexModel(widget.type, widget.logid, widget.psd, context,
          Provider.of<Util>(context), Provider.of<MyInfo>(context)),
      builder: (context, model, child) {
        return Scaffold(
          backgroundColor: Color(0xff7500ff),
          body: Column(
            children: [
              SizedBox(height: ScreenService.height * 0.1),
              Text(
                'Last step: Permissions',
                style: TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                  fontSize: 25,
                ),
              ),//白色字
              SizedBox(height: ScreenService.height * 0.05),
              Container(
                width: ScreenService.width*0.8,
                child: Text(
                  'We need these permissions to get into the entertaining video chat sessions',
                  style: TextStyle(
                    color: Color(0xffea9d53),
                    fontWeight: FontWeight.bold,
                    fontSize: 20,
                  ),
                ),
              ),//黄色字
              SizedBox(height: ScreenService.height * 0.07),
              GestureDetector(
                onTap: (){
                  model.isboy();
                },
                child: Container(
                  height: ScreenService.width*0.3,
                  width: ScreenService.height*0.3,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular((40)),
                    color: Color(0xff4902a0),
                  ),
                  child: Column(
                    children: [
                      Container(
                        margin: EdgeInsets.only(top: 20),
                        child: Image.asset(
                          'assets/image/boy_black.png',
                          width: 30,
                          height: 30,
                          color: model.nochooseboy,
                        ),
                      ),
                      const SizedBox(height: 15,),
                      Container(
                        child: Text(
                          'MAN',
                          style: TextStyle(
                              color: model.nochooseboy,
                              fontWeight: FontWeight.bold,
                              fontSize: 20
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),//boy
              SizedBox(height: ScreenService.height * 0.03),
              GestureDetector(
                onTap: (){
                  model.isgirl();
                },
                child: Container(
                  height: ScreenService.width*0.3,
                  width: ScreenService.height*0.3,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular((40)),
                    color: Color(0xff4902a0),
                  ),
                  child: Column(
                    children: [
                      Container(
                        margin: EdgeInsets.only(top: 20),
                        child: Image.asset(
                          'assets/image/girl_black.png',
                          width: 30,
                          height: 30,
                          color: model.nochoosegirl,
                        ),
                      ),
                      const SizedBox(height: 15,),
                      Container(
                        child: Text(
                          'WOMAN',
                          style: TextStyle(
                              color: model.nochoosegirl,
                              fontWeight: FontWeight.bold,
                              fontSize: 20
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),//girl
              Expanded(child: Container()),
              Container(
                height:50,
                width: 300,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular((30)),
                  color: model.nols,
                ),
                child: GestureDetector(
                  behavior: HitTestBehavior.opaque,
                  onTap: (){
                    model.regUser();
                  },
                  child: Container(
                    margin: EdgeInsets.only(left: 100,top: 10),
                    child: Text(
                      "Let's start!",
                      style: TextStyle(
                        color: model.fontcolor,
                        fontSize: 20,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                ),
              ),
              Expanded(child: Container()),
            ],
          ),
        );
      },
    );
  }
}
